
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

    <f:view>
    <h:head>
        <title><h:outputLabel id="accountTouristRegistration" value ="#{bundle['account.touristRegister.title']}"/></title>
    </h:head>
    <h:body>
        <h:form id="touristRegister">
            <!-- LOCALIZATION -->
            <!-- this selectedLocale menu must always be at the top of the form -->
            <h:selectOneMenu id="selectedLocale" value="#{indexManagedBean.selectedLocale}">
                <f:selectItems value="#{enumLanguage.listItems}" />

                <p:ajax update="accountTouristRegistration
                                panel
                                allMessages
                                panelGridTouristCreate
                                accountTouristUsernameLabel
                                accountTouristCheckUsernameButton
                                accountTouristPasswordLabel 
                                accountTouristConfirmPasswordLabel
                                accountTouristLastnameLabel
                                accountTouristFirstnameLabel
                                accountTouristGenderLabel
                                accountTouristBirthdateLabel
                                accountTouristCountryLabel
                                accountTouristLocaleLabel
                                accountTouristEmailSecondaryLabel
                                accountRegisterButton" 
                        listener="#{indexManagedBean.selectedLocaleValueChangeListener}" />
            </h:selectOneMenu>
            <!-- this end selectedLocale menu must always be at the top of the form -->
            <!-- END LOCALIZATION-->
            
            
            
            <!-- panel for dividing web page into sections -->
            <p:panel id="panel" header="#{bundle['account.header.panel']}">  
                <p:messages id="allMessages"/>

                <h:panelGrid id="panelGridTouristCreate" columns="3"  cellpadding="5" >
                    <h:outputLabel id="accountTouristUsernameLabel" value ="#{bundle['account.username.label']}" style="font-weight: bold"/>
                    <p:inputText id="username" value="#{touristRegisterManagedBean.username}" required="true" requiredMessage="#{bundle['account.username.required']}" >
                        <f:validator validatorId="checkValidEmail" />
                    </p:inputText>
                    <p:message for="username"/>
                    
                    <h:outputLabel id="accountTouristPasswordLabel" value="#{bundle['account.password.label']}" style="font-weight: bold" />
                    <h:inputSecret id="password" value="#{touristRegisterManagedBean.password}" binding="#{pw}" required="true" requiredMessage="#{bundle['account.password.required']}" validatorMessage="#{bundle['account.password.validatorLength']}">
                        <f:validateLength minimum="6" />
                    </h:inputSecret>
                    <p:message for="password"/>
                    
                    <h:outputLabel id="accountTouristConfirmPasswordLabel" value="#{bundle['account.confirmpassword.label']}" style="font-weight: bold"/>
                    <h:inputSecret id="confirmpassword" value="#{touristRegisterManagedBean.confirmPassword}" required="true" requiredMessage="#{bundle['account.confirmpassword.required']}" >
                        <f:validator validatorId="matchPassword" />
                        <f:attribute name="pw" value="#{pw}" />
                    </h:inputSecret>
                    <p:message for="confirmpassword"/>
                
                    <h:outputLabel id="accountTouristLastnameLabel" value ="#{bundle['account.lastname.label']}" style="font-weight: bold"/>
                    <h:inputText id="lastname" value="#{touristRegisterManagedBean.lastname}" required="true" requiredMessage="#{bundle['account.lastname.required']}"/>
                    <p:message for="lastname"/>
                    
                    <h:outputLabel id="accountTouristFirstnameLabel" value="#{bundle['account.firstname.label']}" style="font-weight: bold"/>
                    <h:inputText id="firstname" value="#{touristRegisterManagedBean.firstname}" required="true" requiredMessage="#{bundle['account.firstname.required']}"/>
                    <p:message for="firstname"/>
                 
                    
                    <h:outputLabel id="accountTouristGenderLabel" value="#{bundle['account.gender.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="gender" value="#{touristRegisterManagedBean.gender}" required="true" requiredMessage="#{bundle['account.gender.required']}">
                        <f:selectItems value="#{enumGender.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="gender"/>
                    
                    <h:outputLabel id="accountTouristBirthdateLabel" value ="#{bundle['account.birthdate.label']}" style="font-weight: bold" />
                    <p:calendar id="birthdate" value="#{touristRegisterManagedBean.birthdate}" showOn="button" required="true" requiredMessage="#{bundle['account.birthdate.required']}"/>
                    <p:message for="birthdate"/>
                    
                    <h:outputLabel id="accountTouristCountryLabel" value ="#{bundle['account.country.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="country" value="#{touristRegisterManagedBean.country}" required="true" requiredMessage="#{bundle['account.country.required']}">
                        <f:selectItems value="#{enumCountry.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="country"/>
                    
                    <h:outputLabel id="accountTouristLocaleLabel" value ="#{bundle['account.languagepreferred.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="locale" value="#{touristRegisterManagedBean.locale}" required="true" requiredMessage="#{bundle['account.languagepreferred.required']}">
                        <f:selectItems value="#{enumLanguage.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="locale"/>
                    
                    <h:outputLabel id="accountTouristEmailSecondaryLabel" value ="#{bundle['account.emailSecondary.label']}" style="font-weight: bold"/>
                    <h:inputText id="emailSecondary" value="#{touristRegisterManagedBean.emailSecondary}" validatorMessage="#{bundle['account.username.validatorEmailFormat']}"/>
                    <p:message for="emailSecondary"/>
                </h:panelGrid>
                
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:commandButton id="accountRegisterButton" value="#{bundle['account.register.button']}" update="panel" actionListener="#{touristRegisterManagedBean.registerTourist}" ajax="true" />
            </p:panel> 

        </h:form>
    </h:body>
    </f:view>
</html>

